# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=neighbor-cache-fingerprinter
pkgver=83.f1e596f
pkgrel=3
groups=('blackarch' 'blackarch-fingerprint' 'blackarch-networking')
pkgdesc='An ARP based Operating System version scanner.'
arch=('x86_64' 'aarch64')
url='https://github.com/PherricOxide/Neighbor-Cache-Fingerprinter'
license=('GPL3')
depends=('boost' 'libdnet' 'libpcap')
makedepends=('git')
source=("$pkgname::git+https://github.com/PherricOxide/Neighbor-Cache-Fingerprinter.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i \
    's|/usr/local/share/ncf/ncf-fingerprints|/usr/share/neighbor-cache-fingerprinter/ncf-fingerprints|' \
    src/Config.cpp
}

build() {
  cd $pkgname

  ./configure --prefix=/usr --with-boost

  make
}

package() {
  cd $pkgname

  install -Dm 755 src/neighbor-fingerprint "$pkgdir/usr/bin/neighbor-fingerprint"
  install -Dm 644 ncf-fingerprints "$pkgdir/usr/share/$pkgname/ncf-fingerprints"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README
  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

